### Python3 错误和异常

# a = 10/0
# print(a)

# while True:
#     try:
#         x = int(input('input number:'))
#         # continue
#         break
#     except ValueError:
#         print('input error!')


# while True:
#     try:
#         a = 10/0                    # 运行到此就会报错
#         print(a)
#     except ValueError:
#         print('不可以除以 0 !')

import sys
try:
    f = open('d:\\Users\\Administrator\\Desktop\\python-demo\\python\\demo\\14.Python 输入和输出\\test2.text','w')
    s = f.readline()
    i = int(s.strip())
    

except OSError as err:
    print('os error: {0}'.format(err))
except ValueError:
    print('Could not convert data to an integer')
except:
    print('Unexpected error',sys.exc_info()[0])
    raise
    

